﻿<UserControl x:Class="Sautom.Modules.Proposal.Views.ProposalIndex"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:res="clr-namespace:Sautom.I18N;assembly=Sautom.I18N"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <Style TargetType="TextBox">
            <Setter Property="Width" Value="100" />
            <Setter Property="Height" Value="20" />
            <Setter Property="Margin" Value="10,5,0,0" />
        </Style>
        <Style TargetType="Label">
            <Setter Property="Margin" Value="10,5,0,0" />
        </Style>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="30" />
            <RowDefinition Height="70" />
            <RowDefinition Height="250*" />
        </Grid.RowDefinitions>
        <Menu Grid.Row="0">
            <MenuItem Header="{Binding Source={x:Static res:ProposalResources.CreateProposalBtn}}" Command="{Binding EditProposalCommand}" CommandParameter="true" />
            <MenuItem Header="{Binding Source={x:Static res:ProposalResources.EditProposalBtn}}" Command="{Binding EditProposalCommand}" CommandParameter="false"/>
            <!--<MenuItem Header="{Binding Source={x:Static res:ProposalResources.CountriesListBtn}}" Command="{Binding ListCountiresCommand}" CommandParameter="false"/>
            <MenuItem Header="Ставки" Command="{Binding RatesCommand}" CommandParameter="false"/>-->
        </Menu>
        <WrapPanel Orientation="Horizontal" Grid.Row="1" Margin="10,0,0,0">
            <Label Content="{Binding Source={x:Static res:ProposalResources.ProgramTypeFilterLabel}}" Margin="0,0,10,0" />
            <CheckBox Margin="0,0,10,0" Content="{Binding Source={x:Static res:ProposalResources.ProposalIndividualTypeLabel}}" IsChecked="{Binding IsIndividualFilter}" />
            <CheckBox Margin="0,0,10,0" Content="{Binding Source={x:Static res:ProposalResources.ProposalGroupTypeLabel}}" IsChecked="{Binding IsGroupFilter}" />
            <Label Content="{Binding Source={x:Static res:ProposalResources.CountryFilterLabel}}" />
            <TextBox Text="{Binding CountryFilter}" />
            <Label Content="{Binding Source={x:Static res:ProposalResources.SchoolNameFilterLabel}}" />
            <TextBox Text="{Binding SchoolNameFilter}" />
            <Label Content="{Binding Source={x:Static res:ProposalResources.CourseNameFilterLabel}}" />
            <TextBox Text="{Binding CourseNameFilter}" />
        </WrapPanel>
        <DataGrid Grid.Row="2" IsReadOnly="True" ItemsSource="{Binding Proposals}" SelectionMode="Single" 
                  SelectionUnit="FullRow" SelectedItem="{Binding SelectedItem}" CanUserReorderColumns="False" 
                  CanUserResizeColumns="False" CanUserResizeRows="False" CanUserSortColumns="True" 
                  AlternatingRowBackground="Gainsboro"  AlternationCount="2" AutoGenerateColumns="False" Grid.RowSpan="2">
            <DataGrid.Columns>
                <DataGridTextColumn Header="{Binding Source={x:Static res:ProposalResources.CountryLabel}}" Binding="{Binding Path=Country}" />
                <DataGridTextColumn Header="{Binding Source={x:Static res:ProposalResources.CityLabel}}" Binding="{Binding Path=City}" />
                <DataGridTextColumn Header="{Binding Source={x:Static res:ProposalResources.SchoolNameLabel}}" Binding="{Binding Path=SchoolName}" />
                <DataGridTextColumn Header="{Binding Source={x:Static res:ProposalResources.CourseNameLabel}}" Binding="{Binding Path=CourseName}" />
                <DataGridTextColumn Header="{Binding Source={x:Static res:ProposalResources.ProposalTypeLabel}}"  Binding="{Binding Path=ProposalType}" />
                <DataGridTextColumn Header="{Binding Source={x:Static res:ProposalResources.CuratorNameLabel}}" Binding="{Binding Path=CuratorName}" />
                <DataGridTextColumn Header="{Binding Source={x:Static res:ProposalResources.StartDateLabel}}" Binding="{Binding Path=StartDate, StringFormat=d}" />
                <DataGridTextColumn Header="{Binding Source={x:Static res:ProposalResources.EndDateLabel}}" Binding="{Binding Path=EndDate, StringFormat=d}" />
            </DataGrid.Columns>
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="MouseDoubleClick">
                    <i:InvokeCommandAction Command="{Binding EditProposalCommand}" CommandParameter="false" />
                </i:EventTrigger>
            </i:Interaction.Triggers>
        </DataGrid>

    </Grid>
</UserControl>
